<?php
class Mod_materi extends CI_Model
{
    function __construct()
    {
        parent::__construct();
    }
	
	function get_guru()
	{
		$sql 	= "SELECT g.kode_dosen
				, g.nama
				FROM tbl_dosen g";
		$rec	= $this->db->query($sql);
		$res	= $rec->result_array();
		return $res;
	}
	
	function get_materi($kode_guru, $kode_kajur, $kode_mapel, $start)
	{
		$sql 	= "SELECT m.judul
				, m.keterangan
				, m.file_upload
				, j.nama_jurusan
				, p.mata_kuliah
				FROM tbl_materi m
				INNER JOIN tbl_dosen g
				ON g.kode_dosen = m.kode_dosen
				INNER JOIN tbl_jurusan j
				ON j.kode_jurusan = m.kode_jurusan
				INNER JOIN tbl_mata_kuliah p
				ON p.kode_mata_kuliah = m.kode_mata_kuliah
				WHERE m.kode_dosen = '$kode_guru'
				ORDER BY j.nama_jurusan, p.mata_kuliah, m.judul";
//		echo $sql;
		$rec	= $this->db->query($sql);
		$res	= $rec->result_array();
		return $res;
	}
}